import datetime
import json
import time

import requests
from bs4 import BeautifulSoup


def getMeassage():
    url = 'http://43.138.27.164:58744/'
    response = requests.get(url)
    response.encoding = 'utf-8'
    soup = BeautifulSoup(response.text, 'html.parser')
    return soup

def sendMessage():
    token = '875a94a2a2e0441790c814a0aad6c15d'  # 在pushpush网站中可以找到
    title = '账号信息'  # 改成你要的标题内容
    content = str(getMeassage())  # 改成你要的正文内容
    url = 'http://www.pushplus.plus/send'
    data = {
        "token": token,
        "title": title,
        "content": content
    }
    body = json.dumps(data).encode(encoding='utf-8')
    headers = {'Content-Type': 'application/json'}
    requests.post(url, data=body, headers=headers)


while 1 == 1:
    print(datetime.datetime.now(),getMeassage())
    sendMessage()
    time.sleep(3600)
